﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Dracham.MapEditor.Maps;
using Dracham.MapEditor.Singleton;
using Dracham.MapEditor.Zones;
using Dracham.MapEditor.Zones.Events.Actions;

namespace Dracham.MapEditor.TileEvents
{
    public partial class frmTileEventTeleport : Form
    {
        public Int32 X { get { return (Int32)this.nudX.Value; } }
        public Int32 Y { get { return (Int32)this.nudY.Value; } }
        public Zone Zone { get { return (Zone)this.cbZone.SelectedItem; } }

        public frmTileEventTeleport(ZoneTile zoneTile, Teleport tp)
        {
            InitializeComponent();

            foreach (Zone z in DrachamMapEditor.ZoneManager.Zones)
            {
                cbZone.Items.Add(z);

                if (tp != null && tp.Zone == z)
                {
                    cbZone.SelectedItem = z;
                }
            }

            if (tp != null)
            {
                this.nudX.Value = tp.X;
                this.nudY.Value = tp.Y;
            }
        }

        private void btnSaveTeleport_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }
    }
}
